function confirmUpload(serverFileName, clientFileName, fileType) {
	//如果用户确认要上传这个附件，就把附件的链接贴到用户的输入框中
	var filePath;
	if (fileType == "picture")
		filePath = '<img src="' + serverFileName + '"' + '>' + '</img>';
	else
		filePath = '<a href="' + serverFileName + '"' + '>' + clientFileName
				+ '</a>';
	addAttachLinkToTextarea(filePath);
}

function addAttachLinkToTextarea(str) {
	//将str添加到特定的ckEditor中
	CKEDITOR.instances.ckeditor.insertHtml(str);
}

function uploadFile() {
	//用户确认上传文件之后，要做的事情
	//1.将输入框清空
	setTimeout("clearFilePath()", 1000);
}

function clearFilePath() {
	$("#filePath")[0].value = "";
}

function addAttachmentToDiv(serverFileName, clientFileName, fileType) {
	//这个函数的作用是在attachment块中添加用户上传的附件的链接，由动态刷新的iframe调用

	var linkBlock = '<a href="' + serverFileName + '"' + '>' + clientFileName
			+ '</a>';
	var buttonBlock;
	var newLine = '<br>';
	var divArticleArea = $("#articleArea");
	var divAttachmentArea = $("#attachment_area");
	if (fileType == "picture") {
		buttonBlock = '<button type="button" onclick="confirmUpload(' + "'"
				+ serverFileName + "'" + "," + "'" + clientFileName + "'" + ","
				+ "'" + fileType + "'" + ')">插入图片</button>';
	} else {
		buttonBlock = '<button type="button" onclick="confirmUpload(' + "'"
				+ serverFileName + "'" + "," + "'" + clientFileName + "'" + ","
				+ "'" + fileType + "'" + ')">插入附件链接</button>';
	}

	divAttachmentArea.after(linkBlock + buttonBlock + newLine);

};
